home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 1.iso / dist / fw_teTeX.idb / usr / freeware / info / dvips.info-3.z / dvips.info-3 (.txt)
GNU Info File  |  2001-01-10  |  48KB  |  815 lines

  1. This is Info file dvips.info, produced by Makeinfo version 1.68 from
  2. the input file dvips.texi.
  3. INFO-DIR-SECTION TeX
  4. START-INFO-DIR-ENTRY
  5. * DVI-to-Postscript: (dvips).        Translating TeX DVI files to PostScript.
  6. * afm2tfm: (dvips)Invoking afm2tfm.  Making Type 1 fonts available to TeX.
  7. * dvips: (dvips)Invoking Dvips.      DVI-to-PostScript translator.
  8. END-INFO-DIR-ENTRY
  9. File: dvips.info,  Node: Metric files,  Next: Glyph files,  Up: Font concepts
  10. Metric files
  11. ------------
  12.   A "metric file" describes properties of the font that are independent
  13. of what the characters actually look like.  Aside from general
  14. information about the font itself, a metric file has two kinds of
  15. information: information about individual characters, organized by
  16. character code, and information about sequences of characters.
  17.   The per-character information specifies the width, height, depth, and
  18. italic correction of each character in the font.  Any might be zero.
  19.   In addition to information on individual characters, the metric file
  20. specifies "kerning", i.e., adding or removing space between particular
  21. character pairs.  It further specifies "ligature" information: when a
  22. sequence of input characters should be typeset as a single (presumably
  23. different) "ligature" character.  For example, it's traditional for the
  24. input `fi' to be typeset as `fi', not as `fi' (with the dot of the `i'
  25. colliding with `f').  (In English, the only common ligatures are fi,
  26. fl, ff, ffi, and ffl.)
  27.   Different typesetting systems use different metric file formats:
  28.    * Each Postscript font has an "Adobe font metrics" (`.afm') file.
  29.      These files are plain text, so you can inspect them easily.  You
  30.      can get AFM files for Adobe's fonts from
  31.      `ftp://ftp.adobe.com/pub/adobe/Fonts/AFMs'.
  32.    * TeX uses "TeX font metrics" (`.tfm') files. When you say `\font =
  33.      FONT' in your TeX document, TeX reads a file named `FONT.tfm'.
  34.      (Well, except for the `texfonts.map' feature; *note Fontmap:
  35.      (kpathsea)Fontmap.).  TeX can then calculate the space occupied by
  36.      characters from the font when typesetting. In addition, the DVI
  37.      drivers you use to print or view the DVI file produced by TeX may
  38.      need to look at the TFM file.
  39.      TFM files are binary (and hence are typically much smaller than AFM
  40.      files). You can use the `tftopl' program (*note tftopl invocation:
  41.      (web2c)tftopl invocation.) that comes with TeX to transform a TFM
  42.      file into a human-readable "property list" (`.pl') file.  You can
  43.      also edit a PL file and transform it back to a TeX-readable TFM
  44.      with the companion program `pltotf' (*note pltotf invocation:
  45.      (web2c)pltotf invocation.).  Editing metrics by hand is not
  46.      something you're likely to want to do often, but the capability is
  47.      there.
  48.    * ATM and other typesetting systems use "printer font metric"
  49.      (`.pfm') files. These are binary files. They are irrelevant in the
  50.      TeX world, and not freely available, so we will not discuss them
  51.      further.
  52.   The Afm2tfm program distributed with Dvips converts an AFM file to a
  53. TFM file and performs other useful transformations as well.  *Note
  54. Invoking afm2tfm::.
  55. File: dvips.info,  Node: Glyph files,  Next: Virtual fonts,  Prev: Metric files,  Up: Font concepts
  56. Glyph files
  57. -----------
  58.   Although a metric file (see the previous section) contains information
  59. about the spatial and other properties of the character at position 75,
  60. say, it contains nothing about what the character at position 75
  61. actually looks like. The glyphs--the actual shapes of the letterforms
  62. in a font--are defined by other files, which we call glyph files.  TeX
  63. itself only reads the TFM file for a font; it does not need to know
  64. character shapes.
  65.   A "glyph file" is a file that defines the shapes of the characters in
  66. a font.  The shapes can be defined either by outlines or by bitmaps.
  67.   PostScript fonts are defined as "outline fonts": Each character in
  68. the font is defined by giving the mathematical curves (lines, arcs, and
  69. splines) that define its contours.  Different sizes of a character are
  70. generated by linearly scaling a single shape. For example, a 10-point
  71. `A' is simply half the size of a 20-point `A'.  Nowadays, outline fonts
  72. usually also contain "hints"--additional information to improve the
  73. appearance of the font at small sizes or low resolutions.
  74.   Although various kinds of PostScript outline fonts exist, by far the
  75. most common, and the only one we will consider, is called "Type 1".
  76. The glyph files for Postscript Type 1 fonts typically have names ending
  77. in `.pfa' ("printer font ASCII") or `.pfb' ("printer font binary").
  78.   In contrast, glyph files for Computer Modern and the other standard
  79. TeX fonts are "bitmap fonts", generated from Metafont (`.mf')
  80. descriptions.  The Metafont program distributed with TeX generates
  81. bitmaps from these descriptions.
  82.   The glyph files for TeX bitmap fonts are usually stored in "packed
  83. font" (PK) files.  The names of these files end in `.NNNpk', where NNN
  84. is the resolution of the font in dots per inch.  For example,
  85. `cmr10.600pk' contains the bitmaps for the `cmr10' font at a resolution
  86. of 600dpi.  (On DOS filesystems, it's more likely `dpi600\cmr10.pk'.)
  87.   Metafont actually outputs "generic font" (GF) files, e.g.,
  88. `cmr10.600gf', but the GF files are usually converted immediately to PK
  89. format (using the `gftopk' utility that comes with TeX) since PK files
  90. are smaller and contain the same information. (The GF format is a
  91. historical artifact.)
  92. File: dvips.info,  Node: Virtual fonts,  Next: Encodings,  Prev: Glyph files,  Up: Font concepts
  93. Virtual fonts
  94. -------------
  95.   A "virtual font" is constructed by extracting characters from one or
  96. more existing fonts and rearranging them, or synthesizing new characters
  97. in various ways.  The explanation in this manual is intended to suffice
  98. for understanding enough about virtual fonts to use them with Dvips. It
  99. isn't a reference manual on virtual fonts.  For more information: The
  100. primary document on virtual fonts is Donald E. Knuth, `TUGboat' 11(1),
  101. Apr. 1990, pp. 13-23, "Virtual Fonts: More Fun for Grand Wizards"
  102. (`CTAN:/info/virtual-fonts.knuth'; for CTAN info, *note unixtex.ftp:
  103. (kpathsea)unixtex.ftp.).  (Don't be intimidated by the subtitle.)
  104.   A virtual font (`.vf') file specifies, for each character in the
  105. virtual font, a recipe for typesetting that character.  A VF file, like
  106. a TFM file, is in a compressed binary format.  The `vftovp' and
  107. `vptovf' programs convert a VF file to a human-readable VPL (virtual
  108. property list) format and back again.  *Note vftovp invocation:
  109. (web2c)vftovp invocation, and *Note vptovf invocation: (web2c)vptovf
  110. invocation.
  111.   In the case of a PostScript font F being used in a straightforward
  112. way, the recipe says: character I in the VF font is character J in font
  113. F.  The font F is called a "base font".  For example, the VF file could
  114. remap the characters of the PostScript font to the positions where TeX
  115. expects to find them.  *Note Encodings::.
  116.   Since TeX reads only TFM files, not VF's, each VF must have a
  117. corresponding TFM for use with TeX.  This corresponding TFM is created
  118. when you run `vptovf'.
  119.   You can "expand" virtual fonts into their base fonts with DVIcopy
  120. (*note dvicopy invocation: (web2c)dvicopy invocation.).  This is useful
  121. if you are using a DVI translator that doesn't understand vf's itself.
  122. File: dvips.info,  Node: Encodings,  Next: PostScript typesetting,  Prev: Virtual fonts,  Up: Font concepts
  123. Encodings
  124. ---------
  125.   Every font, whatever its type, has an "encoding", that specifies the
  126. correspondence between "logical" characters and character codes.  For
  127. example, the ASCII encoding specifies that the character numbered 65
  128. (decimal) is an uppercase `A'.  The encoding does not specify what the
  129. character at that position looks like; there are lots of ways to draw an
  130. `A', and a glyph file (*note Glyph files::.) tells how.  Nor does it
  131. specify how much space that character occupies; that information is in a
  132. metric file (*note Metric files::.).
  133.   TeX implicitly assumes a particular encoding for the fonts you use
  134. with it.  For example, the plain TeX macro `\'', which typesets an
  135. acute accent over the following letter, assumes the acute accent is at
  136. position 19 (decimal). This happens to be true of standard TeX fonts
  137. such as Computer Modern, as you might expect, but it is not true of
  138. normal PostScript fonts.
  139.   It's possible but painful to change all the macros that assume
  140. particular character positions.  A better solution is to create a new
  141. font with the information for the acute accent at position 19, where
  142. TeX expects it to be.  *Note Making a font available::.
  143.   PostScript represents encodings as a sequence of 256 character names
  144. called an "encoding vector".  An "encoding file" (`.enc') gives such a
  145. vector, together with ligature and kerning information (with which we
  146. are not concerned at the moment).  These encoding files are used by the
  147. Afm2tfm program.  Encoding files are also downloaded to the PostScript
  148. interpreter in your printer if you use one of them in place of the
  149. default encoding vector for a particular PostScript font.
  150.   Examples of encodings: the `dvips.enc' encoding file that comes with
  151. Dvips in the `reencode' directory is a good (but not perfect)
  152. approximation to the TeX encoding for TeX's Computer Modern text fonts.
  153. This is the encoding of the fonts that originated with Dvips, such as
  154. `ptmr.tfm'.  The distribution includes many other encoding files; for
  155. example, `8r.enc', which is the base font for the current PostScript
  156. font distribution, and three corresponding to the TeX mathematics
  157. fonts: `texmext.enc' for math extensions, `texmital.enc' for math
  158. italics, and `texmsym.enc' for math symbols.
  159. File: dvips.info,  Node: PostScript typesetting,  Prev: Encodings,  Up: Font concepts
  160. How PostScript typesets a character
  161. -----------------------------------
  162.   The output of Dvips is a program in the PostScript language that
  163. instructs your (presumably PostScript-capable) printer how to typeset
  164. your document by transforming it into toner on paper.  Your printer, in
  165. turn, contains a PostScript interpreter that carries out the
  166. instructions in this typesetting program.
  167.   The program must include the definition of any PostScript fonts that
  168. you use in your document.  Fonts built into your printer (probably the
  169. standard 35: `Times-Roman', `ZapfDingbats', ...) are defined within the
  170. interpreter itself.  Other fonts must be downloaded as pfa or pfb files
  171. (*note Glyph files::.) from your host (the computer on which you're
  172. running Dvips).
  173.   You may be wondering exactly how a PostScript interpreter figures out
  174. what character to typeset, with this mass of metrics, glyphs, encodings,
  175. and other information.  (If you're not wondering, skip this section ...)
  176.   The basic PostScript operator for imaging characters is `show'.
  177. Suppose you've asked TeX to typeset an `S'. This will eventually wind
  178. up in the Dvips output as the equivalent of this PostScript operation:
  179.      (S) show
  180. Here is how PostScript typesets the `S':
  181.   1. PostScript interpreters use ASCII; therefore `S' is represented as
  182.      the integer 83. (Any of the 256 possible characters representable
  183.      in a standard 8-bit byte can be typeset.)
  184.   2. A PostScript "dictionary" is a mapping of names to arbitrary
  185.      values.  A font, to the interpreter, is a dictionary which
  186.      contains entries for certain names.  (If these entries are
  187.      missing, the interpreter refuses to do anything with that font.)
  188.      PostScript has a notion of "the current font"--whatever font is
  189.      currently being typeset in.
  190.   3. One of the mandatory entries in a font dictionary is `Encoding',
  191.      which defines the encoding vector (*note Encodings::.) for that
  192.      font.  This vector of 256 names maps each possible input character
  193.      to a name.
  194.   4. The interpreter retrieves the entry at position 83 of the encoding
  195.      vector. This value is a PostScript name: `/S'.
  196.   5. For Type 1 fonts (we're not going to discuss anything else), the
  197.      interpreter now looks up `/S' as a key in a dictionary named
  198.      `CharStrings', another mandatory entry in a font dictionary.
  199.   6. The value of `S' in `CharStrings' is the equivalent of a series of
  200.      standard PostScript commands like `curveto', `lineto', `fill', and
  201.      so on. These commands are executed to draw the character. There
  202.      can also be "hint information" that helps adapt the character to
  203.      low-resolution rasters.  (*Note Glyph files::.)  The commands are
  204.      actually represented in a more compact way than standard
  205.      PostScript source; see the Type 1 book for details.
  206.   This method for typesetting characters is used in both Level 1 and
  207. Level 2 PostScript.  See the PostScript reference manuals for more
  208. information.
  209. File: dvips.info,  Node: Making a font available,  Next: Invoking afm2tfm,  Prev: Font concepts,  Up: PostScript fonts
  210. Making a PostScript font available
  211. ==================================
  212.   To make a PostScript font available in a TeX document, you need to
  213. install the font on your system and then define it within the document.
  214. Once you have installed the font, of course, it is available for any
  215. document thereafter and you don't need to reinstall it.  You must have
  216. an AFM file for any font you install. Unless the font is built into your
  217. printer, you must also have a PFA or PFB file.
  218.   In the following examples, we use the font `Times-Roman' to
  219. illustrate the process.  But you should use the prebuilt fonts for Times
  220. and the other standard fonts, rather than rebuilding them.  The prebuilt
  221. fonts are made using a more complicated process than that described
  222. here, to make them work as well as possible with TeX.  So following the
  223. steps in this manual will not generate files identical to the
  224. distributed ones.  *Note PostScript font installation::, for pointers to
  225. the prebuilt fonts.
  226.   Installation of a PostScript font proceeds in three steps.  *Note
  227. Font concepts::, for descriptions of the various files involved.
  228.   1. Run `afm2tfm' to create a TFM file for the original font, and the
  229.      VPL form of the virtual font:
  230.           afm2tfm Times-Roman -v ptmr rptmr
  231.   2. Run `vptovf' to generate a VF and TFM file for the virtual font
  232.      from the VPL file:
  233.           vptovf ptmr.vpl ptmr.vf ptmr.tfm
  234.   3. Insert an entry for the font in `psfonts.map' (*Note
  235.      psfonts.map::):
  236.           rptmr      Times-Roman                 <ptmr8a.pfa
  237.   4. Install the files in the standard locations, as in:
  238.           cp ptmr.vf FONTDIR/vf/...
  239.           cp *ptmr.tfm FONTDIR/tfm/...
  240.           cp ptmr.afm FONTDIR/afm/...
  241.           cp ptmr.pf? FONTDIR/type1/...
  242.   The simplest invocation of Afm2tfm to make virtual fonts goes
  243. something like this:
  244.      afm2tfm Times-Roman -v ptmr rptmr
  245. This reads the file `Times-Roman.afm', and produces two files as
  246. output, namely the virtual property list'file `ptmr.vpl', and the "raw"
  247. font metric file `rptmr.tfm'. To use the font in TeX, you first run
  248.      vptovf ptmr.vpl ptmr.vf ptmr.tfm
  249. You should then install the virtual font file `ptmr.vf' where Dvips
  250. will see it and install `ptmr.tfm' and `rptmr.tfm' where TeX and Dvips
  251. will see them.
  252.   Using these raw fonts is not recommended; there are no raw fonts in
  253. the prebuilt PostScript fonts distributed along with Dvips.  But
  254. nevertheless, that's how Afm2tfm presently operates, so that's what we
  255. document here.  The `r' prefix convention is likewise historical
  256. accident.
  257.   You can also make more complex virtual fonts by editing `ptmr.vpl'
  258. before running `vptovf'; such editing might add the uppercase Greek
  259. characters in the standard TeX positions, for instance.  (This has
  260. already been done for the prebuilt fonts.)
  261.   Once the files have been installed, you're all set. You can now do
  262. things like this in TeX:
  263.      \font\myfont = ptmr at 12pt
  264.      \myfont Hello, I am being typeset in 12-point Times-Roman.
  265.   Thus, we have two fonts, one actual (`rptmr', which is analogous to
  266. the font in the printer) and one virtual (`ptmr', which has been
  267. remapped to the standard TeX encoding (almost)), and has typesetting
  268. know-how added. You could also say
  269.      \font\raw = rptmr at 10pt
  270. and typeset directly with that, but then you would have no ligatures or
  271. kerning, and you would have to use Adobe character positions for special
  272. letters like the ligature `AE'.  The virtual font `ptmr' not only has
  273. ligatures and kerning, and most of the standard accent conventions of
  274. TeX, it also has a few additional features not present in the Computer
  275. Modern fonts. For example, it includes all the Adobe characters (such
  276. as the Polish ogonek and the French guillemots).  The only things you
  277. lose from ordinary TeX text fonts are the dotless `j' (which can be
  278. hacked into the VPL file with literal PostScript specials if you have
  279. the patience) and uppercase Greek letters (which just don't exist
  280. unless you buy them separately).  *Note Reencoding with Afm2tfm::.
  281.   As a final step you need to record information about both the virtual
  282. font and the original font (if you ever might want to use it) in the
  283. `psfonts.map' file (*note psfonts.map::.).  For our example, you'd
  284. insert the following into `psfonts.map':
  285.      rptmr      Times-Roman                 <ptmr8a.pfa
  286. Of course, `Times-Roman' is already built in to most every printer, so
  287. there's no need to download any Type 1 file for it.  But if you are
  288. actually following these instructions for new fonts, most likely they
  289. are not built in to the printer.
  290.   These PostScript fonts can be scaled to any size.  Go wild!  Using
  291. PostScript fonts, however, does use up a great deal of the printer's
  292. memory and it does take time.  You may find downloading bitmap fonts
  293. (possibly compressed, with the `Z' option) to be faster than using the
  294. built-in PostScript fonts.
  295. File: dvips.info,  Node: Invoking afm2tfm,  Next: psfonts.map,  Prev: Making a font available,  Up: PostScript fonts
  296. Invoking Afm2tfm
  297. ================
  298.   The Afm2tfm program converts an AFM file for a PostScript font to a
  299. TFM file and a VPL file for a corresponding virtual font (or, in its
  300. simplest form, to a TFM file for the PostScript font itself).  The
  301. results of the conversion are affected by the command-line options and
  302. especially by the reencodings you can specify with those options.  You
  303. can also obtain special effects such as an oblique font.
  304.   An alternative to Afm2tfm for creating virtual fonts is Alan Jeffrey's
  305. `fontinst' program, available from `CTAN:fonts/utilities/fontinst' (for
  306. CTAN info, *note unixtex.ftp: (kpathsea)unixtex.ftp.).
  307. * Menu:
  308. * Changing font encodings::     Reencoding with -t, -p, -T.
  309. * Special font effects::        Oblique fonts, small caps, and such.
  310. * Afm2tfm options::             afm2tfm command-line options.
  311. File: dvips.info,  Node: Changing font encodings,  Next: Special font effects,  Up: Invoking afm2tfm
  312. Changing font encodings
  313. -----------------------
  314.   Afm2tfm allows you to specify a different encoding for a PostScript
  315. font (for a general introduction to encodings, *note Encodings::.). The
  316. `-t' options changes the TeX encoding, `-p' changes the PostScript
  317. encoding, and `-T' changes both simultaneously, as detailed in the
  318. sections below.
  319. * Menu:
  320. * Changing TeX encodings::      Where TeX finds a character.
  321. * Changing PostScript encodings::  Where PostScript finds a character.
  322. * Changing both encodings::     One and the same, simultaneously.
  323. * Reencoding with Afm2tfm::     Problems with the default encoding.
  324. * Encoding file format::        Syntax of an encoding file.
  325. File: dvips.info,  Node: Changing TeX encodings,  Next: Changing PostScript encodings,  Up: Changing font encodings
  326. `-t': Changing TeX encodings
  327. ............................
  328.   To build a virtual font with Afm2tfm, you specify the `-v' or `-V'
  329. option. You can then specify an encoding for that virtual font with `-t
  330. TEX-ENC'.  (`-t' is ignored if neither `-v' nor `-V' is present.)  Any
  331. ligature and kerning information you specify in TEX-ENC will be used in
  332. the VPL, in addition to the ligature and kerning information from the
  333. AFM file.
  334.   If the AFM file has no entry for a character specified in TEX-ENC,
  335. that character will be omitted from the output VPL.
  336.   The `-t' option is likely to be needed when you have a PostScript
  337. font corresponding to a TeX font other than a normal text font such as
  338. Computer Modern.  For instance, if you have a PostScript font that
  339. contains math symbols, you'd probably want to use the encoding in the
  340. `texmsym.enc' file supplied with Dvips. (For a start; to actually get
  341. usable math fonts, you have to define much more than just an encoding.)
  342. File: dvips.info,  Node: Changing PostScript encodings,  Next: Changing both encodings,  Prev: Changing TeX encodings,  Up: Changing font encodings
  343. `-p': Changing PostScript encodings
  344. ...................................
  345.   By default, Afm2tfm uses the encoding it finds in the AFM file.  You
  346. can specify a different PostScript encoding with `-p PS-ENC'.  This
  347. makes the raw TFM file (the one output by Afm2tfm) have the encoding
  348. specified in the encoding file PS-ENC.  Any ligature or kern
  349. information specified in PS-ENC is ignored by Afm2tfm, since ligkern
  350. info is always omitted from the raw TFM.
  351.   If you use this option, you must also arrange to download PS-ENC as
  352. part of any document that uses this font.  You do this by adding a line
  353. like the following one to `psfonts.map' (*note psfonts.map::.):
  354.      zpopr Optima "MyEncoding ReEncodeFont" <myenc.enc
  355.   Using `-p' is the only way to access characters in a PostScript font
  356. that are neither encoded in the AFM file nor constructed from other
  357. characters.  For instance, Adobe's `Times-Roman' font contains the
  358. extra characters `trademark' and `registered' (among others); these can
  359. only be accessed through such a PostScript reencoding.
  360.   In fact, the `8r' base encoding used for the current PostScript font
  361. distribution (available at `ftp://ftp.tug.org/tex/psfonts.tar.gz') does
  362. do this reencoding, for precisely this reason.
  363. File: dvips.info,  Node: Changing both encodings,  Next: Reencoding with Afm2tfm,  Prev: Changing PostScript encodings,  Up: Changing font encodings
  364. `-T': Changing both TeX and PostScript encodings
  365. ................................................
  366.   The option `-T ENC-FILE' is equivalent to `-p ENC-FILE -t ENC-FILE'.
  367. If you make regular use of a private non-standard reencoding `-T' is
  368. usually a better idea than the individual options, to avoid unexpected
  369. inconsistencies in mapping otherwise.  An example of when you might use
  370. this option is a dingbats font: when you have a TeX encoding that is
  371. designed to be used with a particular PostScript font.
  372. File: dvips.info,  Node: Reencoding with Afm2tfm,  Next: Encoding file format,  Prev: Changing both encodings,  Up: Changing font encodings
  373. Reencoding with Afm2tfm
  374. .......................
  375.   The Afm2tfm program creates the TFM and VF files for the virtual font
  376. corresponding to a PostScript font by "reencoding" the PostScript font.
  377. Afm2tfm generates these files from two encodings: one for TeX and one
  378. for PostScript.  The TeX encoding is used to map character numbers to
  379. character names while the PostScript encoding is used to map each
  380. character name to a possibly different number.  In combination, you can
  381. get access to any character of a PostScript font at any position for
  382. TeX typesetting.
  383.   In the default case, when you specify none of the `-t', `-p', or `-T'
  384. options, Afm2tfm uses a default TeX encoding (which mostly corresponds
  385. to the Computer Modern text fonts) and the PostScript encoding found in
  386. the AFM file being read.  The reencoding is also sometimes called a
  387. "remapping".
  388.   For example, the default encodings reencode the acute accent in two
  389. steps: first the default TeX encoding maps the number 19 to the
  390. character name `acute'; then the default PostScript encoding, as found
  391. in the AFM file for an ordinary PostScript font, maps the character
  392. name `acute' to the number 194.  (The PostScript encoding works in
  393. reverse, by looking in the encoding vector for the name and then
  394. yielding the corresponding number.)  The combined mapping of 19 to 194
  395. shows up explicitly in the VF file and also implicitly in the fact that
  396. the properties of PostScript character 194 appear in position 19 of the
  397. TFM file for the virtual font.
  398.   The default encoding of the distributed fonts (e.g., `ptmr.tfm')
  399. mostly follows plain TeX conventions for accents.  The exceptions: the
  400. Hungarian umlaut (which is at position `0x7D' in `cmr10', but position
  401. `0xCD' in `ptmr'); the dot accent (at positions `0x5F' and `0xC7',
  402. respectively); and the Scandinavian A ring `\AA', whose definition
  403. needs different tweaking.  In order to use these accents with
  404. PostScript fonts or in math mode when `\textfont0' is a PostScript
  405. font, you will need to use the following definitions.  These
  406. definitions will not work with the Computer Modern fonts for the
  407. relevant accents.  They are already part of the distributed
  408. `psfonts.sty' for use with LaTeX.
  409.      \def\H#1{{\accent"CD #1}}
  410.      \def\.#1{{\accent"C7 #1}}
  411.      \def\dot{\mathaccent"70C7 }
  412.      \newdimen\aadimen
  413.      \def\AA{\leavevmode\setbox0\hbox{h}\aadimen\ht0
  414.        \advance\aadimen-1ex\setbox0\hbox{A}\rlap{\raise.67\aadimen
  415.        \hbox to \wd0{\hss\char'27\hss}}A}
  416.   As a kind of summary, here are the `CODINGSCHEME's that result from
  417. the various possible choices for reencoding.
  418. default encoding
  419.           (CODINGSCHEME TeX text + AdobeStandardEncoding)
  420. `-p dc.enc'
  421.           (CODINGSCHEME TeX text + DCEncoding)
  422. `-t dc.enc'
  423.           (CODINGSCHEME DCEncoding + AdobeStandardEncoding)
  424. `-T dc.enc'
  425.           (CODINGSCHEME DCEncoding + DCEncoding)
  426. The `CODINGSCHEME' line appears in the VPL file but is ignored by Dvips.
  427. File: dvips.info,  Node: Encoding file format,  Prev: Reencoding with Afm2tfm,  Up: Changing font encodings
  428. Encoding file format
  429. ....................
  430.   Afm2tfm's encoding files have the same format as an encoding vector
  431. in a PostScript font.  Here is a skeletal example:
  432.      % Comments are ignored, unless the first word after the percent sign
  433.      % is `LIGKERN'; see below.
  434.      /MyEncoding [ % exactly 256 entries follow, each with a leading `/'
  435.        /Alpha /Beta /Gamma /Delta ...
  436.        /A /B ... /Z
  437.        ...  /.notdef /xfooaccent /yfooaccent /zfooaccent
  438.      ] def
  439.   These encoding files are downloaded as part of changing the encoding
  440. at the PostScript level (see the previous section).
  441.   Comments, which start with a percent sign and continue until the end
  442. of the line, are ignored unless they start with `LIGKERN' (see below).
  443.   The first non-comment word of the file must start with a forward slash
  444. `/' (i.e., a PostScript literal name) and defines the name of the
  445. encoding.  The next word must be an left bracket `['.  Following that
  446. must be precisely 256 character names; use `/.notdef' for any that you
  447. want to leave undefined.  Then there must be a matching right bracket
  448. `]'.  A final `def' token is optional.  All names are case-sensitive.
  449.   Any ligature or kern information is given as a comment.  If the first
  450. word after the `%' is `LIGKERN', then the entire rest of the line is
  451. parsed for ligature and kern information.  This ligature and kern
  452. information is given in groups of words: each group is terminated by a
  453. space and a semicolon and (unless the semicolon is at the end of a
  454. line) another space.
  455.   In these `LIGKERN' statements, three types of information may be
  456. specified.  These three types are ligature pairs, kerns to ignore, and
  457. the character value of this font's boundary character.
  458.   Throughout a `LIGKERN' statement, the boundary character is specified
  459. as `||'. To set the font's boundary character value for TeX:
  460.      % LIGKERN || = 39 ;
  461.   To indicate a kern to remove, give the names of the two characters
  462. (without the leading slash) separated by `{}', as in `one {} one ;'.
  463. This is intended to be reminiscent of the way you might use `{}' in a
  464. TeX file to turn off ligatures or kerns at a particular location.
  465. Either or both of the character names can be given as `*', which is a
  466. wild card matching any character; thus, all kerns can be removed with
  467. `* {} * ;'.
  468.   To specify a ligature, specify the names of the pair of characters,
  469. followed by the ligature operation (as in Metafont), followed by the
  470. replacing character name.  Either (but not both) of the first two
  471. characters can be `||' to indicate a word boundary.
  472.   The most common operation is `=:' meaning that both characters are
  473. removed and replaced by the third character, but by adding the `|'
  474. character on either side of the `=:', you can retain either or both of
  475. the two leading characters.  In addition, by suffixing the ligature
  476. operation with one or two `>' signs, you can make the ligature scanning
  477. operation skip that many resulting characters before proceeding.  This
  478. works just like in Metafont.  For example, the `fi' ligature is
  479. specified with `f i =: fi ;'.  A more convoluted ligature is `one one
  480. |=:|>> exclam ;' which separates a pair of adjacent `1''s with an
  481. exclamation point, and then skips over two of the resulting characters
  482. before continuing searching for ligatures and kerns.  You cannot give
  483. more >'s than |'s in an ligature operation, so there are a total of
  484. eight possibilities:
  485.      =: |=: |=:> =:| =:|> |=:| |=:|> |=:|>>
  486.   The default set of ligatures and kerns built in to Afm2tfm is:
  487.      % LIGKERN question quoteleft =: questiondown ;
  488.      % LIGKERN exclam quoteleft =: exclamdown ;
  489.      % LIGKERN hyphen hyphen =: endash ; endash hyphen =: emdash ;
  490.      % LIGKERN quoteleft quoteleft =: quotedblleft ;
  491.      % LIGKERN quoteright quoteright =: quotedblright ;
  492.      % LIGKERN space {} * ; * {} space ; 0 {} * ; * {} 0 ;
  493.      % LIGKERN 1 {} * ; * {} 1 ; 2 {} * ; * {} 2 ; 3 {} * ; * {} 3 ;
  494.      % LIGKERN 4 {} * ; * {} 4 ; 5 {} * ; * {} 5 ; 6 {} * ; * {} 6 ;
  495.      % LIGKERN 7 {} * ; * {} 7 ; 8 {} * ; * {} 8 ; 9 {} * ; * {} 9 ;
  496. File: dvips.info,  Node: Special font effects,  Next: Afm2tfm options,  Prev: Changing font encodings,  Up: Invoking afm2tfm
  497. Special font effects
  498. --------------------
  499.   Besides the reencodings described in the previous section, Afm2tfm can
  500. do other manipulations.  (Again, it's best to use the prebuilt fonts
  501. rather than attempting to remake them.)
  502.   `-s SLANT' makes an obliqued variant, as in:
  503.      afm2tfm Times-Roman -s .167 -v ptmro rptmro
  504. This creates `ptmro.vpl' and `rptmro.tfm'.  To use this font, put the
  505.      rptmro Times-Roman ".167 SlantFont"
  506. into `psfonts.map'.  Then `rptmro' (our name for the obliqued Times)
  507. will act as if it were a resident font, although it is actually
  508. constructed from Times-Roman via the PostScript routine `SlantFont'
  509. (which will slant everything 1/6 to the right, in this case).
  510.   Similarly, you can get an expanded font with
  511.      afm2tfm Times-Roman -e 1.2 -v ptmrre rptmrre
  512. and by recording the pseudo-resident font
  513.      rptmrre Times-Roman "1.2 ExtendFont"
  514. in `psfonts.map'.
  515.   You can also create a small caps font with a command such as
  516.      afm2tfm Times-Roman -V ptmrc rptmrc
  517. This will generate a set of pseudo-small caps mapped into the usual
  518. lowercase positions and scaled down to 0.8 of the normal cap
  519. dimensions.  You can also specify the scaling as something other than
  520. the default 0.8:
  521.      afm2tfm Times-Roman -c 0.7 -V ptmrc rptmrc
  522.   It is unfortunately not possible to increase the width of the small
  523. caps independently of the rest of the font.  If you want a really
  524. professional looking set of small caps, you need to acquire a small caps
  525. font.
  526.   To change the `PaintType' in a font from filled (0) to outlined (2),
  527. you can add `"/PaintType 2 store"' to `psfonts.map', as in the
  528. following:
  529.      rphvrl   Helvetica "/PaintType 2 store"
  530.   Afm2tfm writes to standard output the line you need to add to
  531. `psfonts.map' to use that font, assuming the font is resident in the
  532. printer; if the font is not resident, you must add the `<FILENAME'
  533. command to download the font.  Each identical line only needs to be
  534. specified once in the `psfonts.map' file, even though many different
  535. fonts (small caps variants, or ones with different output encodings)
  536. may be based on it.
  537. File: dvips.info,  Node: Afm2tfm options,  Prev: Special font effects,  Up: Invoking afm2tfm
  538. Afm2tfm options
  539. ---------------
  540.   Synopsis:
  541.      afm2tfm [OPTION]... AFMFILE[.afm] [TFMFILE[.tfm]]
  542.   Afm2tfm reads AFMFILE and writes a corresponding (but raw) TFM file.
  543. If TFMFILE is not supplied, the base name of the AFM file is extended
  544. with `.tfm' to get the output filename.
  545.   The simplest example:
  546.      afm2tfm Times-Roman rptmr
  547. The TFM file thus created is "raw" because it omits ligature and kern
  548. information, and does no character remapping; it simply contains the
  549. character information in the AFM file in TFM form, which is the form
  550. that TeX understands.  The characters have the same code in the TFM
  551. file as in the AFM file.  For text fonts, this means printable ASCII
  552. characters will work ok, but little else, because standard PostScript
  553. fonts have a different encoding scheme than the one that plain TeX
  554. expects (*note Encodings::.).  Although both schemes agree for the
  555. printable ASCII characters, other characters such as ligatures and
  556. accents vary.  Thus, in practice, it's almost always desirable to create
  557. a virtual font as well with the `-v' or `-V' option.  *Note Making a
  558. font available::.
  559.   The command line options to Afm2tfm:
  560. `-c RATIO'
  561.      See `-V'; overrides the default ratio of 0.8 for the scaling of
  562.      small caps.
  563. `-e RATIO'
  564.      Stretch characters horizontally by RATIO; if less than 1.0, you
  565.      get a condensed font.
  566.      Output all character codes in the `vpl' file as octal numbers, not
  567.      names; this is useful for symbol or other special-purpose fonts
  568.      where character names such as `A' have no meaning.
  569. `-p PS-ENC'
  570.      Use PS-ENC for the destination (PostScript) encoding of the font;
  571.      PS-ENC must be mentioned as a header file for the font in
  572.      `psfonts.map'.  *Note Changing PostScript encodings::.
  573. `-s SLANT'
  574.      Slant characters to the right by SLANT.  If SLANT is negative, the
  575.      letters slope to the left (or they might be upright if you start
  576.      with an italic font).
  577. `-t TEX-ENC'
  578.      Use TEX-ENC for the target (TeX) encoding of the font.  Ligature
  579.      and kern information may also be specified in FILE.  FILE is not
  580.      mentioned in `psfonts.map'.
  581. `-T PS-TEX-ENC'
  582.      Use PS-TEX-ENC for both the PostScript and target TeX encodings of
  583.      the font.  Equivalent to `-p FILE -t FILE'.
  584.      Use only those characters specified in the TeX encoding, and no
  585.      others.  By default, Afm2tfm tries to include all characters in the
  586.      input font, even those not present in the TeX encoding (it puts
  587.      them into otherwise-unused positions, arbitrarily).
  588. `-v VPL-FILE'
  589.      Output a VPL (virtual property list) file, as well as a TFM file.
  590. `-V VPL-FILE'
  591.      Same as `-v', but the virtual font generated is a pseudo small caps
  592.      font obtained by scaling uppercase letters by 0.8 to typeset
  593.      lowercase. This font handles accented letters and retains proper
  594.      kerning.
  595. File: dvips.info,  Node: psfonts.map,  Prev: Invoking afm2tfm,  Up: PostScript fonts
  596. `psfonts.map': PostScript font catalog
  597. ======================================
  598.   The `psfonts.map' file associates a PostScript font with related
  599. files and constructs.  Each line has the format:
  600.      FILENAME POSTSCRIPT-NAME OPTIONS
  601.   For example, the line
  602.      rpstrn StoneInformal <StoneInformal.pfb
  603. causes Dvips to download `StoneInformal.pfb' if your document (just as
  604. if it were a header file, *note Header files::.) uses the font
  605. `StoneInformal'.
  606.   If the `j' config file or command-line option is enabled,
  607. `StoneInformal.pfb' will be "partially downloaded"--only those
  608. characters your document actually uses will be extracted and downloaded,
  609. and the remainder discarded.  *Note Option details::.
  610.   Filenames of fonts that are partially downloaded are surrounded by
  611. curly braces (`{...}') in the progress report Dvips writes to standard
  612. output.  Wholly-downloaded fonts appear inside angle brackets
  613. (`<...>'), like other downloaded files.
  614.   Adobe Multiple Master fonts, such as Minion, cannot be partially
  615. downloaded.  To partially download in general, but avoid partial
  616. downloading for individual fonts, use `<<' instead `<':
  617.      pmnr8r Minion <<Minion.pfb
  618.   You can generate transformed fonts with a line like this:
  619.      rpstrc StoneInformal <StoneInformal.pfb ".8 ExtendFont"
  620. *Note Special font effects::, for a complete list of font effects.
  621.   You can change the encoding of the Type 1 font at the PostScript
  622. level with a `ReEncodeFont' instruction, plus the name of the encoding
  623. file.  This allows you access to characters that may be present in the
  624. Type 1 font file, but not encoded by default--most of the preaccented
  625. characters, for example.  An example:
  626.      pstrn8r StoneInformal "TeXBase1Encoding ReEncodeFont" <8r.enc <pstrn8a.pfb
  627.   The `8r' encoding mentioned here has been designed to serve as a base
  628. for all downloadable fonts; it allows access to all the characters
  629. commonly present in a Type 1 font.  For more details, see the `8r.enc'
  630. source file that comes with (and is installed with) Dvips.
  631.   You may notice that the same syntax is used for downloading encoding
  632. vectors and Type 1 font files. To make your intentions clear, you can
  633. also use `<[' to explicitly indicate you are downloading an encoding
  634. vector, as in:
  635.      pstrn8r StoneInformal "TeXBase1Encoding ReEncodeFont" <[8r.enc <pstrn8a.pfb
  636.   If the filename of your encoding vector does not end in `.enc', and
  637. you are using partial font downloading, you must use the `<[' syntax,
  638. or Dvips will not download the font properly.
  639.   Similarly, the name of the Type 1 font file itself must have extension
  640. `.pfa' or `.pfb' for partial downloading to work properly.
  641.   When using PFB files, Dvips is smart enough to unpack the binary PFB
  642. format into printable ASCII so there is no need to perform this
  643. conversion yourself.  In addition, Dvips scans the font to determine its
  644. memory usage, just as it does for other header files (*note Header
  645. files::.).
  646.   Here is a brief summary of how `psfonts.map' is read:
  647.   1. If a line is empty or begins with a space, percent, asterisk,
  648.      semicolon, or hash mark, it is ignored.
  649.   2. Otherwise, the line is separated into words, where words are
  650.      separated by spaces or tabs, except that if a word begins with a
  651.      double quote, it extends until the next double quote or the end of
  652.      the line.
  653.   3. If a word starts with `<<', it is taken as a font file to be
  654.      wholly downloaded.  Use this to avoid partial downloading, as
  655.      described above.
  656.   4. If a word starts with `<[', it is taken as an encoding file to be
  657.      downloaded.  Use this if the name of the encoding file does end in
  658.      `.enc', also as described above.
  659.   5. If a word starts with a `<' character, it is treated as a header
  660.      file that needs to be downloaded.  If the name ends in `.pfa' or
  661.      `.pfb', it is taken as Type 1 font file that will be partially
  662.      downloaded if the `j' option is in effect.  There can be more than
  663.      one such header for a given font.  If a `<' is a word by itself,
  664.      the next word is taken as the name of the header file.
  665.   6. If a word starts with a `"' character, it is taken as PostScript
  666.      code used in generating that font, and is inserted into the output
  667.      verbatim at the appropriate point.  (And the double quotes
  668.      beginning and ending the word are removed.)
  669.   7. Otherwise the word is a name. The first such name is the TFM file
  670.      that a virtual font file can refer to.  If there is a second name,
  671.      it is used as the PostScript name; if there is only one name, it
  672.      is used for both the TeX name and the PostScript name.
  673. File: dvips.info,  Node: Color,  Next: Index,  Prev: PostScript fonts,  Up: Top
  674. Color
  675. *****
  676.   Dvips supports one-pass multi-color printing of TeX documents on any
  677. color PostScript device.  Initially added by Jim Hafner, IBM Research,
  678. <hafner@almaden.ibm.com>, the color support has gone through many
  679. changes by Tomas Rokicki.  Besides the source code support itself, there
  680. are additional TeX macro files: `colordvi.tex' and `blackdvi.tex', and
  681. corresponding `.sty' versions for use with LaTeX.
  682.   In this section we describe the use of color from the document
  683. preparer's point of view and then add some instructions on installation
  684. for the TeX administrator.
  685. * Menu:
  686. * Color macro files::           TeX macro definitions.
  687. * User-definable colors::       Adding your own colors.
  688. * Color subtleties::            Subtleties in using color.
  689. * Ted Turner::                  Printing in black/white after colorizing.
  690. * Color device configuration::  Configuring Dvips for color devices.
  691. * Color support details::       Color support details
  692. File: dvips.info,  Node: Color macro files,  Next: User-definable colors,  Up: Color
  693. Color macro files
  694. =================
  695.   All the color macro commands are defined in `colordvi.tex' (or
  696. `colordvi.sty').  To access these macros simply add to the top of your
  697. plain TeX file the command:
  698.      \input colordvi
  699. For (the obsolete) LaTeX 2.09, add the `colordvi' style option as in:
  700.      \documentstyle[12pt,colordvi]{article}
  701. For LaTeX 2e, these examples are not applicable.  Instead, please see
  702. the documentation for the graphics package, available from
  703. `CTAN:doc/latex/graphics/'.  See also `CTAN:doc/epslatex.ps'.
  704.   These macros provide two basic kinds of color macros: ones for local
  705. color changes (a few words, a single symbol) and one for global color
  706. changes (the whole document).  All the color names use a mixed case
  707. scheme to avoid conflicts with other macros.  There are 68 predefined
  708. colors, with names taken primarily from the Crayola crayon box of 64
  709. colors, and one pair of macros for the user to set his own color pattern
  710. (*note User-definable colors::.).  You can browse the file
  711. `colordvi.tex' for a list of the predefined colors.  The comments in
  712. this file also show a rough correspondence between the crayon names and
  713. Pantones.
  714.   A local color command has the form
  715.      \COLORNAME{this is the color COLORNAME}
  716. where COLORNAME is the name of a predefined color, e.g., `Blue'.  As
  717. shown, these macros take one argument, the text to print in the
  718. specified color.  This can be used for nested color changes since it
  719. restores the original color state when it completes.  For example:
  720.      This text is normal but here we are \Red{switching to red,
  721.      \Blue{nesting blue}, recovering the red} and back to original.
  722. The color nesting level has no hard limit, but it is not advisable to
  723. nest too deeply lest you and the reader lose track of the color history.
  724.   The global color command has the form
  725.      \textCOLORNAME
  726. These macros take no arguments and changes the default color from that
  727. point on to COLORNAME.  This of course can be overridden globally by
  728. another such command or locally by local color commands. For example,
  729. expanding on the example above, we might have
  730.      \textGreen
  731.      This text is green but here we are \Red{switching to red,
  732.      \Blue{nesting blue}, recovering the red} and back to
  733.      original green.
  734.      \textCyan
  735.      The text from here on will be cyan until
  736.      \Yellow{locally changed to yellow}. Now we are back to cyan.
  737.   The color commands will even work in math mode and across math mode
  738. boundaries.  This means that if you have a color before going into math
  739. mode, the mathematics will be set in that color as well.  In alignment
  740. environments like `\halign', `tabular' or `eqnarray', local color
  741. commands cannot extend beyond the alignment characters.
  742.   Because local color commands respect only some environment and
  743. delimiter changes besides their own, care must be taken in setting
  744. their scope.  It is best not to have them stretch too far.
  745.   At the present time there are no macros for color environments in
  746. LaTeX which might have a larger range.  This is primarily to keep the
  747. TeX and LaTeX use compatible.
  748. File: dvips.info,  Node: User-definable colors,  Next: Color subtleties,  Prev: Color macro files,  Up: Color
  749. User-definable colors
  750. =====================
  751.   There are two ways for the user to specify colors not already defined.
  752. For local changes, there is the command `\Color' which takes two
  753. arguments.  The first argument is four numbers between zero and one and
  754. specifies the intensity of cyan, magenta, yellow and black (CMYK) in
  755. that order.  The second argument is the text that should appear in the
  756. given color.  For example, suppose you want the words "this color is
  757. pretty" to appear in a color which is 50% cyan, 85% magenta, 40% yellow
  758. and 20% black.  You would use the command
  759.      \Color{.5 .85 .4 .2}{this color is pretty}
  760.   For global color changes, there is a command `\textColor' which takes
  761. one argument, the CMYK quadruple of relative color intensities.  For
  762. example, if you want the default color to be as above, then the command
  763.      \textColor{.5 .85 .4 .2}
  764.      The text from now on will be this pretty color
  765. will do the trick.
  766.   Making a global color change in the midst of nested local colors is
  767. highly discouraged.  Consequently, Dvips will give you warning message
  768. and do its best to recover by discarding the current color history.
  769. File: dvips.info,  Node: Color subtleties,  Next: Ted Turner,  Prev: User-definable colors,  Up: Color
  770. Color subtleties
  771. ================
  772.   Color macros are defined via `\special' keywords.  As such, they are
  773. put in the `.dvi' file only as explicit message strings to the driver.
  774. The (unpleasant) result is that certain unprotected regions of the text
  775. can have unwanted color side effects.  For example, if a color region
  776. is split by TeX across a page boundary, then the footers of the current
  777. page (e.g., the page number) and the headers of the next page can
  778. inherit that color.  To avoid this effect globally, users should make
  779. sure that these special regions of the text are defined with their own
  780. local color commands.  For example, to protect the header and footer in
  781. plain TeX, use
  782.      \headline{\Black{My Header}}
  783.      \footline{\Black{\hss\tenrm\folio\hss}}
  784.   This warning also applies to figures and other insertions, so be
  785. careful!
  786.   Of course, in LaTeX, this is much more difficult to do because of the
  787. complexity of the macros that control these regions.  This is
  788. unfortunate but inevitable, because TeX and LaTeX were not written with
  789. color in mind.
  790.   Even when writing your own macros, much care must be taken.  The
  791. macros that `colorize' a portion of the text work prefix the text work
  792. by outputting one `\special' command to turn the color on before the
  793. text, and outputting another `\special' command afterwards to restore
  794. the original color.  It is often useful to ensure that TeX is in
  795. horizontal mode before the first special command is issued; this can be
  796. done by prefixing the color command with `\leavevmode'.
  797. File: dvips.info,  Node: Ted Turner,  Next: Color device configuration,  Prev: Color subtleties,  Up: Color
  798. Printing in black/white after colorizing
  799. ========================================
  800.   If you have a TeX or LaTeX document written with color macros and you
  801. want to print it in black and white there are two options.  On all
  802. (good) PostScript devices, printing a color file will print in
  803. corresponding gray levels.  This is useful to get a rough idea of the
  804. colors without using expensive color printing devices.  The second
  805. option is to replace the call to input `colordvi.tex' with
  806. `blackdvi.tex' (and similarly for the `.sty' files).  So in the above
  807. example, replacing the word `colordvi' with `blackdvi' suffices.
  808. `blackdvi.tex' defines the color macros as no-ops, and so will produce
  809. normal black/white printing.  By this simple mechanism, the user can
  810. switch to all black/white printing without having to ferret out the
  811. color commands.  Also, some device drivers, particularly non-PostScript
  812. ones like screen previewers, will simply ignore the color commands and
  813. so print in black/white.  Hopefully, in the future screen previewers
  814. for color displays will be compatible with some form of color support.
  815.